Skip to content

Add depth to git_clone() - #281

Merged
jeroen merged 5 commits into
r-lib:mainfrom
etiennebacher:clone-depth
Jul 21, 2026
Merged

Add depth to git_clone()#281
jeroen merged 5 commits into
r-lib:mainfrom
etiennebacher:clone-depth

Conversation

@etiennebacher

@etiennebacher etiennebacher commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This was almost entirely generated by Claude, but I expanded and modified the tests it generated. I also re-built the package with this change and checked that it worked fine.

Fixes #101

Ref in libgit2: https://github.com/libgit2/libgit2/releases/tag/v1.7.0

@etiennebacher
etiennebacher marked this pull request as ready for review July 21, 2026 11:20
@jeroen

jeroen commented Jul 21, 2026

Copy link
Copy Markdown
Member

Thank you. Could you change this into a warning:

Rf_error("Shallow clone (depth) requires libgit2 >= 1.7.0");

The reason is that I worry that people may not realize that using this parameter will break your R code on systems with a somewhat older libgit2. I think in this case, it is better to fall back to doing the non-shallow clone, with a warning, rather than error out.

@etiennebacher

Copy link
Copy Markdown
Contributor Author

Done. BTW, the current test suite ignores some (unrelated) WARNING in R CMD check, e.g.: https://github.com/r-lib/gert/actions/runs/29825254548/job/88617023327?pr=281#step:6:249. Just mentioning it in case it is not expected.

@jeroen
jeroen merged commit 2b4561e into r-lib:main Jul 21, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set clone depth / shallow clone

2 participants